import React, { Component } from 'react'
import style from "./FileListPage.module.css"
import { Card, Image, Space, Table } from 'antd';


const columns = [
    {
        title: '文件名',
        dataIndex: 'fileName',
        width: 150,
    },
    {
        title: '上传时间',
        dataIndex: 'createDt',
        width: 150,
    },
    {
        title: 'Address',
        dataIndex: 'address',
    },
];

export default class FileListPage extends Component {

    // 卡片模式
    cardModeFun = (param) => {
        console.log("pram", param);

        let list = param.map((p) => <Image
            width={200}
            src={p.url}
        />)

        return (
            <Space wrap >
                {list}
            </Space>
        )
    }


    // 详细模式
    detailsModeFun = (param) => {
        return (<Table
            columns={columns}
            dataSource={param}
            
        />)
    }

    renderListFun = (mode, infos) => {
        if (mode) {
            return (
                this.cardModeFun(infos)
            )
        } else {
            return (
                this.detailsModeFun(infos)
            )
        }
    }


    render() {

        const { cardMode, fileInfos } = this.props
        const context = this.renderListFun(cardMode, fileInfos)
        return <div style={{ height: '100%' }}> {context}</div>

    }
}
